<div class="layui-body">
	<div class="aright">
	<div class="arz cl"><a href="{:url('man/article/add')}"><i class="layui-icon">&#xe608;</i>添加题目</a>&nbsp;&nbsp;|&nbsp;&nbsp;<a href="#" onclick="ClearMore();"><i class="layui-icon">&#xe640;</i>清除更多显示缓存</a>&nbsp;&nbsp;|&nbsp;&nbsp;<a href="#" onclick="ClearPage();"><i class="layui-icon">&#xe640;</i>清除测试页面缓存</a></div>

	<form method="get" class="aform cl" >
		<div class="layui-form-item">
	    <label class="layui-form-label">ID：</label>
	    <div class="layui-input-inline">
	      <input type="text" name="aid"  placeholder="请输入ID" autocomplete="on" class="layui-input">
	    </div>
	    <label class="layui-form-label">标题：</label>
	    <div class="layui-input-inline">
	      <input type="text" name="ntitle"  placeholder="请输入关键字" autocomplete="off" class="layui-input">
	    </div>
	    <div class="layui-input-inline">
	    <button class="layui-btn" lay-submit lay-filter="formDemo">搜 索</button>
	      
	    </div>
	  </div>

	<table width="100%">
	      <tr>

			<th width="5%" align="center">ID编号</th>
	        <th width="25%" align="center">文章标题</th>
			<th width="7%" align="center">缩略图</th>
	        <th width="5%" align="center">是否热门</th>
			<th width="5%" align="center">是否置顶</th>
			<th width="7%" align="center">显示在更多</th>
			<th width="5%" align="center">所属分类</th>
			<th width="4%" align="center">点击数</th>
			<th width="9%" align="center">添加时间</th>
	        <th width="23%" align="center">基本操作</th>
	      </tr>
	      {volist name="list" id="vo"}
		  <tr>
			<td align="center">{$vo.id}</td>
	        <td align="center"><a target="_blank" style="color:{$vo.tcolor}" href="{:url('index/index/view',['aid'=>$vo['id']])}">{$vo.ntitle|msubstr=0,30,'utf8',true}</a></td>
			<td align="center">
			{if condition="$vo['nimg'] neq ''"}
	        <img src="http://static-resource.ufile.ucloud.com.cn/{$vo.nimg}" height="30">
	        {else /}
	        暂无缩略图
	        {/if}
			</td>
			<td align="center">{if condition="$vo['nhot'] eq 2"}<span style="color:#FF5722;cursor: pointer;" onclick="upField({$vo.id},'nhot',1)">是</span>{else /}<span style="cursor: pointer;" onclick="upField({$vo.id},'nhot',2)">否</span>{/if}</td>
			<td align="center">{if condition="$vo['nzhiding'] eq 2"}<span style="color:#FF5722;cursor: pointer;" onclick="upField({$vo.id},'nzhiding',1)">已置顶</span>{else /}<span style="cursor: pointer;" onclick="upField({$vo.id},'nzhiding',2)">未置顶</span>{/if}</td>
			<td align="center">{if condition="$vo['nmore'] eq 1"}<span onclick="upField({$vo.id},'nmore',2)" style="color:#FF5722;cursor: pointer;">显示</span>{else /}<span style="cursor: pointer;" onclick="upField({$vo.id},'nmore',1)">隐藏</span>{/if}</td>
			<td align="center">
				{if condition="$vo['nfenlei'] eq 1"}
				<span style="color:#FF5722;">爱情</span>
				{elseif condition="$vo['nfenlei'] eq 2"}
				<span style="color:#F25722;">性格</span>
				{elseif condition="$vo['nfenlei'] eq 3"}
				<span style="color:#455722;">能力</span>
				{elseif condition="$vo['nfenlei'] eq 4"}
				<span style="color:#FF5722;">专业</span>
				{elseif condition="$vo['nfenlei'] eq 5"}
				<span style="color:#22ff22;">财富</span>
				{elseif condition="$vo['nfenlei'] eq 6"}
				<span style="color:#FF5722;">女性</span>
				{elseif condition="$vo['nfenlei'] eq 10"}
				<span style="color:#FF5722;">两性</span>
				{elseif condition="$vo['nfenlei'] eq 11"}
				<span style="color:#cc57f2;">趣味</span>
				{elseif condition="$vo['nfenlei'] eq 12"}
				<span style="color:#FF5722;">心理</span>
				{/if}</td>

			<td align="center">{$vo.nclick}</td>
			<td align="center">{$vo.ntime}</td>
	        <td align="center"><a href="{:url('man/article/edit',['id'=>$vo['id']])}">【编 辑】</a> | <a href="{:url('man/article/item',['nid'=>$vo['id'],'nceng'=>1])}">【选 项】</a> | <a href="{:url('man/article/answer',['nid'=>$vo['id']])}">【结 果】</a> | <a onclick="deleted({$vo.id});">删除</a>| <a onclick="ClearCache({$vo.id});">缓存更新</a>
	        </td>
	      </tr>
	      {/volist}
	 </table>

	  </form>
	 		<div class="pages">
 				{$list->render()}
	 	 	</div>
	</div>
	</div>
</div>
<script>
layui.use('layer',function(){
	var layer = layui.layer;
})
function deleted(aid){
	$.post("{:url('man/article/delete')}",{'aid':aid,'type':1},function(data){
		if(data){
			layer.msg("删除成功");
			setTimeout(function(){
				window.location.reload();
			},1000);
			
		}
	})
}
function ClearCache(aid){
	$.post("{:url('man/article/clearCache')}",{'aid':aid,'type':1},function(data){
		if(data){
			layer.msg("缓存更新成功");
		}else{
			layer.msg("缓存更新失败");
		}
	})
}
function ClearMore(){
	$.post("{:url('man/article/clearMore')}",{},function(data){
		if(data){
			layer.msg("缓存更新成功");
		}else{
			layer.msg("缓存更新失败");
		}
	})
}
function ClearPage(){
	$.post("{:url('man/article/clearPage')}",{},function(data){
		if(data){
			layer.msg("缓存更新成功");
		}else{
			layer.msg("缓存更新失败");
		}
	})
}
function upField(aid,field,val){
	$.post("{:url('man/article/upField')}",{'aid':aid,'field':field,'val':val},function(data){
		if(data){
			layer.msg("更新成功");
			setTimeout(function(){
				window.location.reload();
			},500);
		}else{
			layer.msg("更新失败");
			setTimeout(function(){
				window.location.reload();
			},1000);
		}
	})
}
</script>